<template>
  <div>
    <el-form label-width="auto">
      <el-form-item label="任务名称">
        <el-input v-model="editData.groupName" placeholder="任务名称" />
      </el-form-item>
    </el-form>
    <div class="submit-class">
      <el-button-group>
        <el-button @click="celBtn">取消</el-button>
        <el-button type="primary" @click="saveBtn">确定</el-button>
      </el-button-group>
    </div>
  </div>
</template>

<script setup>
  import {reactive, ref, toRef, getCurrentInstance, onBeforeMount} from 'vue';
  const props = defineProps({
    isShow: {type: Boolean, default: false},
    editData: {type: Object, default: {}},
  });
  const {proxy} = getCurrentInstance();
  const emits = defineEmits(['update:isShow', 'querySysTaskGroup']);
  const saveBtn = () => {
    proxy.$api.system.editSysTaskGroup(props.editData).then(res => {
      if (res.code != -1) {
        proxy.$message({
          type: 'success',
          message: res.msg,
        });
        props.isShow = false;
        emit('querySysTaskGroup');
      } else {
        // 关闭对话框
        proxy.$message({
          type: 'success',
          message: res,
        });
      }
    });
  };
  const celBtn = () => {
    emits('update:isShow', false);
  };
</script>

<style lang="scss" scoped>
  .submit-class {
    text-align: center;
    padding-top: 20px;
  }
</style>
